from django.db import models


# Create your models here.
# 用户表
class User(models.Model):
    id = models.AutoField(primary_key=True)
    user_name = models.CharField(max_length=255, verbose_name='用户名称')
    user_pwd = models.CharField(max_length=255, verbose_name='用户密码')

    class Meta:
        verbose_name_plural = "用户管理"
        verbose_name = '用户'


# 商品表
class Goods(models.Model):
    id = models.AutoField(primary_key=True)
    title = models.TextField(max_length=512, verbose_name='商品名称')
    image_url = models.CharField(max_length=512, verbose_name='商品图片')
    goods_url = models.CharField(max_length=512, verbose_name='商品链接')
    goods_price = models.CharField(max_length=126,verbose_name='价格')
    sales_counter = models.IntegerField(verbose_name='销量')
    sales_volume = models.CharField(max_length=126,verbose_name='付款人数')
    evaluate_all = models.CharField(max_length=126,verbose_name='评价总数')
    evaluate_good = models.CharField(max_length=126,verbose_name='好评数量')
    category = models.CharField(max_length=256, default="", verbose_name='商品分类')

    class Meta:
        verbose_name_plural = "商品管理"
        verbose_name = '商品'


# 分类表
class Category(models.Model):
    id = models.AutoField(primary_key=True)
    category = models.CharField(max_length=255, verbose_name='分类名称')

    class Meta:
        verbose_name_plural = "分类名称"
        verbose_name = '分类'
# python manage.py migrate
# python manage.py makemigrations
# 创建一个管理员账号python manage.py createsuperuser
# 管理员账号 root,密码root123456
